package classes
{
	import classes.event.QueryEvent;
	import classes.tfo.MonsterTO;
	import classes.tfo.WrappedCharacterInfoTO;
	
	import flash.net.NetConnection;
	import flash.net.Responder;
	
	public class ObjectServiceInteracter extends BasedServiceInteracter
	{
		private var getMonsterResponder:Responder;
		private var writeCharacterInfoResponder:Responder;
		
		public function ObjectServiceInteracter(_nc:NetConnection)
		{
			super(_nc);
			getMonsterResponder = new Responder(handleGetMonsterResponder, statusResult);
			writeCharacterInfoResponder = new Responder(handleWriteCharacterInfoResponder, statusResult);
		}
		
		public function getMonster(id:int):void {
			getNetConnector().call("object.getMonster", getMonsterResponder, id);
		}
		
		public function writeCharacterInfo(wrapper:WrappedCharacterInfoTO):void {
			getNetConnector().call("object.writeCharacterInfo", writeCharacterInfoResponder, wrapper);
		}
		
		
		
		private function handleGetMonsterResponder(item:MonsterTO):void {
			dispatchEvent(new QueryEvent(QueryEvent.BATTLE, item));
		}
		
		private function handleWriteCharacterInfoResponder(obj:Object = null):void {
			dispatchEvent(new QueryEvent(QueryEvent.SAVE_CHAR_INFO, null));
		}
	}
}